# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-pyppeteer
_pkgreal=pyppeteer
pkgver=2.0.0
pkgrel=1
pkgdesc="Headless chrome/chromium automation library (unofficial port of puppeteer)"
url="https://pypi.python.org/project/pyppeteer"
arch="noarch !armhf !ppc64le !riscv64 !s390x !x86 !loongarch64" # needs chromium
license="MIT"
depends="
	chromium
	py3-appdirs
	py3-certifi
	py3-importlib-metadata
	py3-pyee
	py3-tqdm
	py3-tornado
	py3-urllib3
	py3-websockets
	"
checkdepends="
	py3-pytest
	py3-pytest-xdist
	py3-syncer
	"
makedepends="py3-setuptools py3-gpep517 py3-wheel poetry"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/pyppeteer/pyppeteer/archive/refs/tags/$pkgver.tar.gz
	disable-test-ignore-https-errors-interception.patch
	use-system-chromium.patch
	"
builddir="$srcdir/$_pkgreal-$pkgver"
subpackages="$pkgname-pyc"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer "$builddir"/.dist/*.whl
	# do not fail since pyppeteer is not actively maintained
	# CI=true disables headfull chromium tests
	CI=true .testenv/bin/python3 -m pytest -v || true
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
8d349b159200dd655fa16900a60c66a811f6b00a8c2a88d243dbf20760a118afc4e3c5427478b2e72ea0c6419ef0ad2fade3692d430cc24ecb4157b693dff51a  py3-pyppeteer-2.0.0.tar.gz
d856e542338d1398cf079f8af38f318a0a879bddd694d3c5a3a3a5f4a8e950a48414d99a862cfaa74437e77be7de45feb45aba11f7b05e7ed30af4f086e5e62f  disable-test-ignore-https-errors-interception.patch
e03fe4256a14662ba711476e22c65293aeb7a224ca1f3f5afb80ad7c4216942af11abd70614e9b409dd8d3e8feb1d38fcb1168fcab0c28165bd0296b5779e3b5  use-system-chromium.patch
"
